package IOStream;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/*
    文件输出流
 */
public class FileOutputStreamDemo {
    public static void main(String[] args) throws IOException {
        String str="hello world";
        File file=new File("c:\\IOStream\\date02.txt");
        //第二个参数为是否追加内容，默认为false
        FileOutputStream fos=new FileOutputStream(file,true);
//        byte buff[]=new byte[2];
        byte chs[]=str.getBytes();
        fos.write(chs);
        fos.close();
    }
}
